package com.wz.project.sap.PRO_LIST_DNLIST.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.wz.framework.aspectj.lang.annotation.Log;
import com.wz.framework.aspectj.lang.enums.BusinessType;
import com.wz.project.sap.PRO_LIST_DNLIST.domain.YppRfcGetWmsProListDnlist;
import com.wz.project.sap.PRO_LIST_DNLIST.service.IYppRfcGetWmsProListDnlistService;
import com.wz.framework.web.controller.BaseController;
import com.wz.framework.web.domain.AjaxResult;
import com.wz.common.utils.poi.ExcelUtil;
import com.wz.framework.web.page.TableDataInfo;

/**
 * 生产订单DNLISTController
 * 
 * @author wz
 * @date 2022-09-20
 */
@Controller
@RequestMapping("/PRO_LIST_DNLIST/PRO_LIST_DNLIST")
public class YppRfcGetWmsProListDnlistController extends BaseController
{
    private String prefix = "PRO_LIST_DNLIST/PRO_LIST_DNLIST";

    @Autowired
    private IYppRfcGetWmsProListDnlistService yppRfcGetWmsProListDnlistService;

    @RequiresPermissions("PRO_LIST_DNLIST:PRO_LIST_DNLIST:view")
    @GetMapping()
    public String PRO_LIST_DNLIST()
    {
        return prefix + "/PRO_LIST_DNLIST";
    }

    /**
     * 查询生产订单DNLIST列表
     */
//    @RequiresPermissions("PRO_LIST_DNLIST:PRO_LIST_DNLIST:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(YppRfcGetWmsProListDnlist yppRfcGetWmsProListDnlist)
    {
        startPage();
        List<YppRfcGetWmsProListDnlist> list = yppRfcGetWmsProListDnlistService.selectYppRfcGetWmsProListDnlistList(yppRfcGetWmsProListDnlist);
        return getDataTable(list);
    }

    /**
     * 导出生产订单DNLIST列表
     */
//    @RequiresPermissions("PRO_LIST_DNLIST:PRO_LIST_DNLIST:export")
    @Log(title = "生产订单DNLIST", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(YppRfcGetWmsProListDnlist yppRfcGetWmsProListDnlist)
    {
        List<YppRfcGetWmsProListDnlist> list = yppRfcGetWmsProListDnlistService.selectYppRfcGetWmsProListDnlistList(yppRfcGetWmsProListDnlist);
        ExcelUtil<YppRfcGetWmsProListDnlist> util = new ExcelUtil<YppRfcGetWmsProListDnlist>(YppRfcGetWmsProListDnlist.class);
        return util.exportExcel(list, "PRO_LIST_DNLIST");
    }

    /**
     * 新增生产订单DNLIST
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存生产订单DNLIST
     */
    @RequiresPermissions("PRO_LIST_DNLIST:PRO_LIST_DNLIST:add")
    @Log(title = "生产订单DNLIST", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(YppRfcGetWmsProListDnlist yppRfcGetWmsProListDnlist)
    {
        return toAjax(yppRfcGetWmsProListDnlistService.insertYppRfcGetWmsProListDnlist(yppRfcGetWmsProListDnlist));
    }

    /**
     * 修改生产订单DNLIST
     */
    @GetMapping("/edit/{VBELN}")
    public String edit(@PathVariable("VBELN") String VBELN, ModelMap mmap)
    {
        YppRfcGetWmsProListDnlist yppRfcGetWmsProListDnlist = yppRfcGetWmsProListDnlistService.selectYppRfcGetWmsProListDnlistById(VBELN);
        mmap.put("yppRfcGetWmsProListDnlist", yppRfcGetWmsProListDnlist);
        return prefix + "/edit";
    }

    /**
     * 修改保存生产订单DNLIST
     */
    @RequiresPermissions("PRO_LIST_DNLIST:PRO_LIST_DNLIST:edit")
    @Log(title = "生产订单DNLIST", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(YppRfcGetWmsProListDnlist yppRfcGetWmsProListDnlist)
    {
        return toAjax(yppRfcGetWmsProListDnlistService.updateYppRfcGetWmsProListDnlist(yppRfcGetWmsProListDnlist));
    }

    /**
     * 删除生产订单DNLIST
     */
    @RequiresPermissions("PRO_LIST_DNLIST:PRO_LIST_DNLIST:remove")
    @Log(title = "生产订单DNLIST", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(yppRfcGetWmsProListDnlistService.deleteYppRfcGetWmsProListDnlistByIds(ids));
    }
}
